{extend name="layout/popup" /}

{block name="content"}
<input type="hidden" name="ajax" id="ajax" value="1">
<link rel="stylesheet" href="__ADMIN__/css/formSelects-v4.css"/>
<div class="popup-header">
    <h1>编辑用户信息</h1>
</div>
<div class="popup-body">
    <form id="form_data" class="layui-form" method="post" action="{:url('save')}">
        <input type="hidden" name="opmode" value="edit">
        <input type="hidden" name="id" id="id" value="{$vo.id}">
        <div class="layui-row">

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">头像：</label>
                    <div class="layui-input-block w19">
                        <div class="image-upload wp100">
                            <div class="input">
                                <input type="hidden" class="image-url" name="avatar" info="请上传头像" value="{$vo.avatar}" />
                            </div>
                            <div class="image-upload-btn">
                                <p>上传头像: 150*150</p>
                            </div>
                            <div class="image"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label">排序：</label>
                    <div class="layui-input-block w6">
                        <input type="text" name="sort" placeholder="" class="layui-input" value="{$vo.sort}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">员工编号：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="staff_no" placeholder="" class="layui-input" check="required" info="员工编号" value="{$vo.staff_no}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">花名：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="nickname" placeholder="" class="layui-input" check="required" info="花名" value="{$vo.nickname}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">姓名：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="real_name" placeholder="" class="layui-input" check="required" info="姓名" value="{$vo.real_name}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">员工手机号：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="username" placeholder="" class="layui-input" check="required" info="员工账号" value="{$vo.username}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">员工简介：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="profile" placeholder="" class="layui-input" check="required" info="员工简介" value="{$vo.profile}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属部门：</label>
                    <div class="layui-input-block w34">
                        <select name="dept_no">
                            {:fill_option($department_list, 'id', 'name', [$vo.dept_no])}
                        </select>
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">账号密码：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="password" placeholder="留空则不改" class="layui-input" info="留空则不改" value="" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">入职时间：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="entry_time" placeholder="" class="layui-input" check="required" info="入职时间" value="{$vo.entry_time}" />
                    </div>
                </div>
            </div>

            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label required">离职时间：</label>
                    <div class="layui-input-block w19">
                        <input type="text" name="resignation_time" placeholder="" class="layui-input" info="离职时间" value="{$vo.resignation_time}" />
                    </div>
                </div>
            </div>

        </div>
    </form>
</div>
<div class="popup-footer">
    <a class="layui-btn layui-btn-primary" onclick="popup_close();">取消</a>
    <a class="layui-btn" onclick="save();">保存</a>
</div>
{/block}
{block name="script"}
<script>
    layui.use(['form', 'jquery', 'formSelects', 'uploader'], function () {
        var form = layui.form;
        var fn = {
            select_dept: function () {
                winopen("{:url('select_dept')}", 560, 470);
            },
            save: function () {
                send_form("form_data", "{:url('save')}", function (ret) {
                    if (ret.code) {
                        layer.msg(ret.msg, {
                            time: 1200
                        }, function () {
                            parent.location.reload(true);
                            popup_close();
                        });
                    } else {
                        layer.msg(ret.msg);
                        return false;
                    }
                });
            }
        };
        win_exp(fn);

        form.render();

    });
</script>
{/block}
